package com.cndw.kungfu.vo;

/**
 * 争霸赛入围名单
 * 
 * 
 * @author <a href="mailto:whz-work@163.com">汪洪州</a>
 * 
 * @since 1.0 Create on 2011-5-18
 */
public class HeroContestPlayerVO implements Comparable<HeroContestPlayerVO> {

	/**
	 * 玩家Id
	 */
	private Long playerId;

	/**
	 * 玩家名字
	 */
	private String playerName;

	/**
	 * 玩家评分
	 */
	private int score;

	/**
	 * 编号
	 */
	private int number;

	/**
	 * 组列
	 */
	private int groupNumber;

	/**
	 * 连胜次数
	 */
	private int wineCounts;

	/**
	 * 战斗中
	 */
	private boolean challenging;

	/**
	 * 是否被淘汰
	 */
	private boolean obsolete;

	/**
	 * 排名
	 */
	private int ranking;

	/**
	 * 上一把是否胜利
	 */
	private boolean previousWin = true;

	public HeroContestPlayerVO(Long playerId, String playerName, int score) {
		this.score = score;
		this.playerId = playerId;
		this.playerName = playerName;
	}

	public HeroContestPlayerVO(Long playerId) {
		this.playerId = playerId;
	}

	public Long getPlayerId() {
		return playerId;
	}

	public void setPlayerId(Long playerId) {
		this.playerId = playerId;
	}

	public String getPlayerName() {
		return playerName;
	}

	public void setPlayerName(String playerName) {
		this.playerName = playerName;
	}

	public boolean isChallenging() {
		return challenging;
	}

	public void setChallenging(boolean challenging) {
		this.challenging = challenging;
	}

	public boolean isObsolete() {
		return obsolete;
	}

	public void setObsolete(boolean obsolete) {
		this.obsolete = obsolete;
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}

	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;

	}

	public int getGroupNumber() {
		return groupNumber;
	}

	public void setGroupNumber(int groupNumber) {
		this.groupNumber = groupNumber;
	}

	public int getWineCounts() {
		return wineCounts;
	}

	public void setWineCounts(int wineCounts) {
		this.wineCounts = wineCounts;
	}

	public int getRanking() {
		return ranking;
	}

	public void setRanking(int ranking) {
		this.ranking = ranking;
	}

	public boolean isPreviousWin() {
		return previousWin;
	}

	public void setPreviousWin(boolean previousWin) {
		this.previousWin = previousWin;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((playerId == null) ? 0 : playerId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		HeroContestPlayerVO other = (HeroContestPlayerVO) obj;
		if (playerId == null) {
			if (other.playerId != null)
				return false;
		} else if (!playerId.equals(other.playerId))
			return false;
		return true;
	}

	@Override
	public int compareTo(HeroContestPlayerVO player) {
		if (player.getScore() >= this.getScore()) {
			return 1;
		} else {
			return -1;
		}
	}
}
